package com.woniuxy.factory;

import com.woniuxy.entity.American;
import com.woniuxy.entity.Chinese;

/*
* 工厂设计模式：用来创建对象
* */

public class FirstFactory {

    public Object doPerson(String nationality){
        if (nationality.equals("中国人")){
            return new Chinese();
        }else if (nationality.equals("美国人")){
            return new American();
        }return null;
    }
}
